/*
 * Copyright (c) 2020-2099 the original author or authors. All rights reserve.
 */
package org.tianyun.cloud.test.datasource;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.tianyun.cloud.common.dto.PageRequest;
import org.tianyun.cloud.common.dto.PageResult;
import org.tianyun.cloud.dashboard.service.MasterDatabaseTestService;
import org.tianyun.cloud.test.BaseTestCase;
import org.tianyun.cloud.utils.JsonUtils;

import java.util.Map;

/**
 * mybatis测试
 *
 * @auther ebert_chan
 */
public class MybatisTestCase extends BaseTestCase {

    private static final Logger LOGGER = LoggerFactory.getLogger(MybatisTestCase.class);

    @Autowired
    private MasterDatabaseTestService masterDatabaseTestService;

    @Test
    public void test() {
        PageRequest request = new PageRequest();
        request.setPageIndex(1);
        request.setPageSize(2);
        PageResult<Map<String, Object>> pageResult = masterDatabaseTestService.list(request);
        LOGGER.info("分页列表：{}", JsonUtils.toJsonString(pageResult));

        request.setPageIndex(2);
        pageResult = masterDatabaseTestService.list(request);
        LOGGER.info("分页列表：{}", JsonUtils.toJsonString(pageResult));
    }

}
